package com.example.function.integration.mapper;

import com.example.function.integration.entity.HuanengImageDataEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @description:金条借据记录表实体
 * @className:CrlDebtIouRecordExtendMapper
 * @author:ext.fengcheng
 * @date:2023/9/18 17:40
 */
public interface CrlDebtIouRecordExtendMapper {

    @Select("select iou.id as id, iou.tenant_id as tenantId, iou.outside_lend_code as iouCode, iou.lend_code as lendCode, cre.credit_apply_no as creditApplyNo  " +
            "from crl_debt_iou_record iou " +
            "left join crl_lend_apply_record lend on iou.lend_code = lend.lend_code " +
            "left join crl_credit_apply_record cre on lend.customer_code = cre.customer_code  " +
            "where iou.tenant_id = #{tenantId,jdbcType=VARCHAR} " +
            "and iou.id > #{startId,jdbcType=BIGINT} " +
            "order by iou.id limit #{limit,jdbcType=INTEGER}")
    List<HuanengImageDataEntity> getHuanengIouData(@Param("tenantId") String tenantId,
                                                   @Param("startId") Long startId,
                                                   @Param("limit") Long limit);
}
